from sqlalchemy.orm import Session

from apis_module.dao.user_dao import UserDao
from backend_module.model.sys_user_model import SysUserModel


class SysUserDao:
    @classmethod
    def get_user_by_login_info(cls, db: Session, login_name: str):
        result = db.query(SysUserModel).filter(SysUserModel.login_name == login_name).first()
        return result

    @classmethod
    def get_user_by_id(cls, db: Session, user_id: int) -> SysUserModel:
        result = db.query(SysUserModel).filter(SysUserModel.user_id == user_id).first()
        return result
